package com.lanou.controller;/*
 * @author 马继耿~
 * @date 2023/10/24 15:10
 * @version 1.0
 * */

import com.alibaba.fastjson.JSON;
import com.lanou.pojo.PaymentDepositEntity;
import com.lanou.pojo.PaymentPreEntity;
import com.lanou.pojo.PaymentTemp;
import com.lanou.pojo.PaymentTempEntity;
import com.lanou.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.TimeZone;

@Api(value = "收费",tags = "收费")
@RestController
@RequestMapping("/charge")
public class MJG_SelectShopIdController {
    @Autowired
    private MJG_SelectShopIdServicce mjg_selectShopIdServicce;
    @ApiOperation(value = "常规收费",httpMethod = "GET")
    @RequestMapping("/RegularCharge")
    public Object RegularCharge(String resourceName) throws IOException, ParseException {
        return mjg_selectShopIdServicce.SelectShopId(resourceName);
    }
    @ApiOperation(value = "预存款",httpMethod = "GET")
    @RequestMapping("/yucundeposit")
    public Object yucundeposit(String resourceName) throws IOException, ParseException {
        return mjg_selectShopIdServicce.SelectYuCun(resourceName);
    }
    @Autowired
    private MJG_SelecctShopToTopService mjg_selecctShopToTopService;
    @ApiOperation(value = "顶部商铺信息",httpMethod = "GET")
    @RequestMapping("/TopShop")
    public Object TopShop(String resourceName) throws IOException, ParseException {
        return mjg_selecctShopToTopService.SelectShop(resourceName);
    }

    @Autowired
    private MJG_ProvisionalService mjg_provisionalService;
    @ApiOperation(value = "临时收费",httpMethod = "GET")
    @RequestMapping("/Provisional")
    public  Object Provisional(String resourceName) throws IOException {
        return mjg_provisionalService.Provisional(resourceName);
    }
    @Autowired
    private MJG_depositService mjg_depositService;
    @ApiOperation(value = "押金收费",httpMethod = "GET")
    @RequestMapping("/deposit")
    public  Object deposit(String resourceName,HttpServletResponse resp){
      return   mjg_depositService.deposit(resourceName);
    }
    @Autowired
    private MJG_lishiService mjg_lishiService;
    @ApiOperation(value = "历史收费",httpMethod = "GET")
    @RequestMapping("/lishiCharge")
    public  Object lishiCharge(String resourceName,HttpServletResponse resp) throws IOException {
        return mjg_lishiService.lishi(resourceName);
    }
    @Autowired
    private MJG_AddlishiService mjg_addlishiService;
    @ApiOperation(value = "添加临时收费",httpMethod = "POST")
    @RequestMapping("/linshiCharge")
//    String resourceName, String userName, String feeItemName, String payType, String amt, String operateTime
    public  String add(@RequestBody PaymentTempEntity paymentTempEntity) throws ParseException, IOException {
        String id = mjg_addlishiService.add(paymentTempEntity);
        System.out.println(id);
        return  id;
    }
    @ApiOperation(value = "删除临时收费",httpMethod = "GET")
    @RequestMapping("/linshituikuanCharge")
//    String resourceName, String userName, String feeItemName, String payType, String amt, String operateTime
    public  void linshituikuanCharge(String id ) {

        mjg_addlishiService.delect(id);
    }
    @Autowired
    private MJG_AddyajinService mjg_addyajinService;
    @ApiOperation(value = "添加押金收费",httpMethod = "POST")
    @RequestMapping("/yajinCharge")
//    String resourceName, String userName, String feeItemName, String payType, String amt, String operateTime
    public  void addyajin(@RequestBody PaymentDepositEntity paymentTempEntity) throws ParseException, IOException {
        mjg_addyajinService.add(paymentTempEntity);
    }
}
